package ex06.pyrmont.core;

import com.sky.JULLog.MyLogger;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;

import java.util.logging.Logger;

/**
 *  监控 context组件的 生命周期;
 *  如果你想监听 wrapper 的, 需要自己写一个  wrapperLIfeCycleListener 去实现 {@link LifecycleListener} 接口
 * */
public class SimpleContextLifecycleListenerV6 implements LifecycleListener {


    private static Logger log = MyLogger.getLogger(SimpleContextLifecycleListenerV6.class);


    public void lifecycleEvent(LifecycleEvent event) {
        Lifecycle lifecycle = event.getLifecycle();
        log.warning("SimpleContextLifecycleListener's event " + event.getType());
        if (Lifecycle.START_EVENT.equals(event.getType())) {
            log.warning("Starting context.");
        } else if (Lifecycle.STOP_EVENT.equals(event.getType())) {
            log.warning("Stopping context.");
        }
    }
}
